package edu.hawaii.teams.halealohacli.command;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
import org.wattdepot.client.WattDepotClient;
import org.junit.Test;

/**
 * Test cases to test functionality of SetBaseLine class.
 * 
 * @author Rylan Kwock
 * 
 */
public class TestMonitorPower {

  /**
   * Performs testing to ensure MonitorPower class is running properly.
   * 
   * @throws Exception - error.
   */
  @Test
  public void testMonitorPower() throws Exception {

    // For connecting to the server and the SetBaseLine class
    WattDepotClient client = new WattDepotClient("http://server.wattdepot.org:8190/wattdepot/");
    String[] baseCommand = null;
    String[] baseCommand2 = null;
    String[] baseCommand3 = null;

    // First case to test inequality
    MonitorPower mp = new MonitorPower();
    String splits = "\\s";
    String command = "Lehua";
    String command2 = "Lehua 5";
    String command3 = "Lehua 15";

    baseCommand = command.split(splits);
    baseCommand2 = command2.split(splits);
    baseCommand3 = command3.split(splits);

    // Test to see that each command gives different amounts of data.
    String output1 = mp.getData(client, baseCommand);
    String output2 = mp.getData(client, baseCommand2);
    String output3 = mp.getData(client, baseCommand3);

    assertNotSame("Testing inequality", output1, output2);
    assertNotSame("Testing inequality", output1, output3);
    assertNotSame("Testing inequality", output2, output3);

    // Test to ensure that separate methods produce the same results.

    MonitorPower mp2 = new MonitorPower();
    String output4 = mp2.getData(client, baseCommand);

    assertEquals("Testing equality of different methods", output1, output4);
  }

}
